diff options
| author | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 19:50:56 -0500 |
|---|---|---|
| committer | Sebastien Castiel <sebastien@castiel.me> | 2023-12-06 19:50:56 -0500 |
| commit | 6ce2329f5ce20f8352e3ea15594f2532ab8a392c (patch) | |
| tree | d8d5fc4697ec0e51cd0267d5c3ffa9d048076c68 /src/app/groups/[groupId]/reimbursement-list.tsx | |
| parent | e747ec3ea02dd01e9ffa9e398e24e6939a5b738c (diff) | |
Reimbursements
Diffstat (limited to 'src/app/groups/[groupId]/reimbursement-list.tsx')
| -rw-r--r-- | src/app/groups/[groupId]/reimbursement-list.tsx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/app/groups/[groupId]/reimbursement-list.tsx b/src/app/groups/[groupId]/reimbursement-list.tsx new file mode 100644 index 0000000..9d3ec49 --- /dev/null +++ b/src/app/groups/[groupId]/reimbursement-list.tsx @@ -0,0 +1,31 @@ +import { Reimbursement } from '@/lib/balances' +import { Participant } from '@prisma/client' + +type Props = { + reimbursements: Reimbursement[] + participants: Participant[] + currency: string +} + +export function ReimbursementList({ + reimbursements, + participants, + currency, +}: Props) { + const getParticipant = (id: string) => participants.find((p) => p.id === id) + return ( + <div className="text-sm"> + {reimbursements.map((reimbursement, index) => ( + <div className="border-t p-4 flex justify-between" key={index}> + <div> + <strong>{getParticipant(reimbursement.from)?.name}</strong> owes{' '} + <strong>{getParticipant(reimbursement.to)?.name}</strong> + </div> + <div> + {currency} {reimbursement.amount.toFixed(2)} + </div> + </div> + ))} + </div> + ) +} |
